import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
import javax.swing.*;

public class GUI extends Applet {
    JButton button_1;
    JButton button_2;
    JButton button_3;
    JButton button_4;
    JLabel label_1;
    JLabel label_2;
    JLabel label_3;
    JLabel label_4;
    JLabel label_5;
    JLabel label_6;
    JLabel label_7;
    JLabel label_8;

    HIGHSCORESTEUERUNG hssteuerung = new HIGHSCORESTEUERUNG();
    BUTTONSTEUERUNG bs = new BUTTONSTEUERUNG(hssteuerung.gethighscore(), this);
    GUI gui = this;

    public void init() {
        guiLayout customLayout = new guiLayout();

        setFont(new Font("Helvetica", Font.PLAIN, 12));
        setLayout(customLayout);

        button_1 = new JButton("Start");
        add(button_1);
        button_1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
            	bs.click(1, gui);
            }
        });

        button_2 = new JButton("Pause");
        add(button_2);
        button_2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
            	bs.click(2, gui);
            }
        });

        button_3 = new JButton("Neues Spiel");
        add(button_3);
        button_3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
            	bs.click(3, gui);
            }
        });

        label_1 = new JLabel("Zeit");
        add(label_1);

        label_2 = new JLabel("nächstes Egg");
        add(label_2);

        label_3 = new JLabel("Punkte");
        add(label_3);

        label_4 = new JLabel("bestes");
        add(label_4);

        button_4 = new JButton("Highscore anzeigen");
        add(button_4);
        button_4.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
            	bs.click(4, gui);
            }
        });
        
        label_5 = new JLabel("label_5");
        add(label_5);

        label_6 = new JLabel("label_6");
        add(label_6);

        label_7 = new JLabel("0");
        add(label_7);

        label_8 = new JLabel(hssteuerung.gethighscore().erstengeben());
        add(label_8);

        setSize(getPreferredSize());

        Screen Spielfeld = new Screen();
        Spielfeld.main(null);
    }

    public static void main(String[] args)
    {

        //highscore machen
        
        GUI applet = new GUI();
        Frame window = new Frame("gui");

        window.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });

        applet.init();
        window.add("Center", applet);
        window.pack();
        window.setVisible(true);
        }
    
    public void zeitsetzen(String zeit)
    {
        label_5.setText(zeit);
    }
	}

class guiLayout implements LayoutManager {

    public guiLayout() {
    }

    public void addLayoutComponent(String name, Component comp) {
    }

    public void removeLayoutComponent(Component comp) {
    }

    public Dimension preferredLayoutSize(Container parent) {
        Dimension dim = new Dimension(0, 0);

        Insets insets = parent.getInsets();
        dim.width = 320 + insets.left + insets.right;
        dim.height = 294 + insets.top + insets.bottom;

        return dim;
    }

    public Dimension minimumLayoutSize(Container parent) {
        Dimension dim = new Dimension(0, 0);
        return dim;
    }

    public void layoutContainer(Container parent) {
        Insets insets = parent.getInsets();

        Component c;
        c = parent.getComponent(0);
        if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+8,152,24);}
        c = parent.getComponent(1);
        if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+40,152,24);}
        c = parent.getComponent(2);
        if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+72,152,24);}
        c = parent.getComponent(3);
        if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+104,80,24);}
        c = parent.getComponent(4);
        if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+136,80,24);}
        c = parent.getComponent(5);
        if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+168,80,24);}
        c = parent.getComponent(6);
        if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+200,80,24);}
        c = parent.getComponent(7);
        if (c.isVisible()) {c.setBounds(insets.left+8,insets.top+240,152,24);}
        c = parent.getComponent(8);
        if (c.isVisible()) {c.setBounds(insets.left+96,insets.top+104,72,24);}
        c = parent.getComponent(9);
        if (c.isVisible()) {c.setBounds(insets.left+96,insets.top+136,72,24);}
        c = parent.getComponent(10);
        if (c.isVisible()) {c.setBounds(insets.left+96,insets.top+168,72,24);}
        c = parent.getComponent(11);
        if (c.isVisible()) {c.setBounds(insets.left+96,insets.top+200,72,24);}
    }
}
